package com.dhr.sarcosuchus.daobase.util;

/**
 * Created by peter.pan on 2016/12/6.
 */

public class StringUtil {

    private StringUtil() {
    }
    /**
     * 检测字符串是否不为空(null,"","null")
     *
     * @param s 需要检测的字符串
     * @return 不为空则返回true，否则返回false
     */
    public static boolean isNotEmpty(String s) {
        return s != null && !"".equals(s) && !"null".equals(s);
    }
    /**
     * 检测字符串是否为空(null,"","null")
     *
     * @param s 需要检测的字符串
     * @return 为空则返回true，不否则返回false
     */
    public static boolean isEmpty(String s) {
        return !isNotEmpty(s);
    }
    /**
     *
     * @param strBuilder 需要除去最后一个字符的字符串
     * @return 除去最后一个字符的字符串
     */
    public static StringBuilder deleteLastChar(StringBuilder strBuilder) {
        if (strBuilder == null || strBuilder.length() == 0) {
            return strBuilder;
        }
        if (strBuilder.length() > 0) {
            strBuilder.deleteCharAt(strBuilder.length() - 1);
        }
        return strBuilder;
    }
}
